<?php
include_once('3rdPartyPHP/galleryLib.php');
include_once('3rdPartyPHP/subnavCategories.php');
function mainContent($imgFolder)
{
	$return = '
	<div class="grid_12 mainContain relative">
		<div class="floaterNav absolute">
			<div class="navHDRSide">'.strtoupper(get('category')).'</div>
				'.getSubNavs(get('category'), 'mainz').'
		</div>
		<div class="gLeft">
			<div class="mainLeft">
			<img src="img/categories/'.get('category').'/main.jpg" />
			</div>
		</div>
		'.(get('category') == 'accessories' ? '<div class="gAcc">
			<div class="mainMidTop midG">
			<img src="img/categories/'.get('category').'/mainR.jpg"/>
			</div>
		</div>' : '<div class="gMid">
			<div class="mainMidTop midD">
				<img src="img/categories/'.get('category').'/mainMT.jpg"/>
			</div>
			<div class="mainMidBottom midD">
				<img src="img/categories/'.get('category').'/mainMB.jpg"/>
			</div>
		</div>
		<div class="gMid">
			<div class="mainRightTop rightD">
			<img src="img/categories/'.get('category').'/mainRT.jpg"/>
			</div>
			<div class="mainRightMid rightD">
			<img src="img/categories/'.get('category').'/mainRM.jpg"/>
			</div>
			<div class="mainRightBottom rightF">
			<img src="img/categories/'.get('category').'/mainRB.jpg"/>
			</div>
		</div>').'
		
	</div>';
	
	return $return;
}
function subCatContent($subCat, $imgFolder)
{
	$sizes['men'] = '
	<div class="sizeBox" rel="s6">6</div>
	<div class="sizeBox" rel="s65">6.5</div>
	<div class="sizeBox" rel="s7">7</div>
	<div class="clear">
	<!--spanner-->
	</div>
	<div class="sizeBox" rel="s8">8</div>
	<div class="sizeBox" rel="s85">8.5</div>
	<div class="sizeBox" rel="s9">9</div>
	<div class="clear">
	<!--spanner-->
	</div>
	<div class="sizeBox" rel="s95">9.5</div>
	<div class="sizeBox" rel="s10">10</div>
	<div class="sizeBox" rel="s11">11</div>
	';
	$sizes['women'] = '
	<div class="sizeBox" rel="s6">6</div>
	<div class="sizeBox" rel="s65">6.5</div>
	<div class="sizeBox" rel="s7">7</div>
	<div class="clear">
	<!--spanner-->
	</div>
	<div class="sizeBox" rel="s75">7.5</div>
	<div class="sizeBox" rel="s8">8</div>
	<div class="sizeBox" rel="s9">9</div>
	<div class="clear">
	<!--spanner-->
	</div>
	<div class="sizeBox" rel="s10">10</div>
	';
	$sizes['accessories'] = '';
	$sizes['search'] = '';
	$sizes['sale'] = '';

	$mainImg = (get('gallery') != 'all' ? '<img src="'.$imgFolder.$subCat.'/main.jpg" />' : '<img src="'.$imgFolder.'all.jpg" />');
	$return = (get('category') == 'search' || get('category') == 'sale' ? '' : '<div id="mainImgTop" class="grid_12 topImage" rel="'.get('category').'">
		'.$mainImg.'
	</div>
	<div class="clear">
	<!--spanner-->
	</div>
	<div class="grid_2 shortcutDivs">
		<h2>Categories:</h2>
		<ul class="shortcuts">
			'.getSubNavs(get('category'), 'galleries').'
		</ul>
		<h2 class="'.get('category').'stuff">Filter By Size:</h2>
		'.$sizes[get('category')].'
	</div>').'
	<div class="grid_1'.(get('category') == 'search' || get('category') == 'sale' ? '2' : '0').'">
		<div class="galleryProper'.(get('category') == 'search' || get('category') == 'sale' ? '' : ' gallN').'">
			'.(get('category') == 'search' || get('category') == 'sale' ? '<br /><br />
			<h3>Men</h3>'.(get('category') == 'search' ? displaySearch('men', str_ireplace('+', ' ', get('searchString'))) : getOnSale('men')).'
			<div class="clear">
			<!--spanner-->
			</div>
			<h3>Women</h3>'.(get('category') == 'search' ? displaySearch('women', str_ireplace('+', ' ', get('searchString'))) : getOnSale('women')).'
			<div class="clear">
			<!--spanner-->
			</div>
			<h3>Accessories</h3>'.(get('category') == 'search' ? displaySearch('accessories', str_ireplace('+', ' ', get('searchString'))) : getOnSale('accessories')) : displayThumbnailGallery(get('category'), get('gallery'), $imgFolder)).'			
		</div>
	</div>
	';
	return $return;
}

function displayPage()
{
	$catImgFolder = './img/categories/'.get('category').'/';
	$output = '
	<div class="grid_12 crumbs">
		<a href="'.INDEX.'home">Home</a> >'.(get('category') == 'search' || get('category') == 'sale' ? ucwords(get('category')).(get('searchString') != 'null' ? ': "'.get('searchString').'"' : '') : '<a href="'.INDEX.'catalogue'.EXT.'category='.get('category').'&gallery=main">'.ucwords(get('category')).'</a>').(get('gallery') == 'main' || get('category') == 'search' || get('category') == 'sale' ? '' : ' > <a href="'.INDEX.'catalogue'.EXT.'category='.get('category').'&gallery='.get('gallery').'">'.ucwords(getSubNavName(get('gallery'))).'</a>').'
	</div>
	<div class="clear">
	<!--spanner-->
	</div>
	
		'.(get('gallery') == 'main' ? mainContent($catImgFolder) : subCatContent(get('gallery'), $catImgFolder)).'
	<div class="clear">
	<!--spanner-->
	</div>
	<div class="grid_12 spannerclass"></div>
	';
	return $output;
}
?>